﻿using SageKing.OpenIddict.UI.Infrastructure;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using SageKing.Extensions;
using Microsoft.Extensions.Configuration;

namespace SageKing.OpenIddict.UI.Infrastructure.Features;

public class OpenIddictUIIdentityCoreFeature : FeatureBase
{
    public OpenIddictUIIdentityCoreFeature(IModule module) : base(module)
    {
    }

    /// <summary>
    /// Represents the options for OpenIds feature.
    /// </summary>
    public Action<OpenIddictUIIdentityCoreOptions> OpenIdOptionsAction { get; set; } = _ => { };

    /// <summary>
    /// 
    /// </summary>
    public OpenIddictUIIdentityCoreOptions OpenIdOptions { get; set; } = new OpenIddictUIIdentityCoreOptions();

    /// <inheritdoc />
    public override void Apply(IConfigurationManager configurationManager, IHostEnvironment hostEnvironment)
    {
        ArgumentNullException.ThrowIfNull(configurationManager);

        //configurationManager.Bind(OpenIdOptions);

        Services.Configure(OpenIdOptionsAction);

    }

}
